<template>
<div>
  <detailTop></detailTop>
  <DetailHeader
  :sightName="sightName"
  :bannerImg="bannerImg"
  :gallaryImgs="gallaryImgs"></DetailHeader>
  <List :list='list'></List>
  <div class="write"></div>
</div>
</template>

<script>
import DetailHeader from './components/DetailHeader'
import detailTop from './components/top'
import List from './components/List'
import axios from 'axios'

export default {
  name: 'Detail',
  data () {
    return {
      sightName: '',
      bannerImg: '',
      gallaryImgs: [],
      list: []
    }
  },
  methods: {
    getDetailInfo () {
      axios.get('/api/detail.json', {
        params: {
          id: this.$route.params.id
        }
      }).then(this.handleGetDataSucc)
    },
    handleGetDataSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.sightName = data.sightName
        this.bannerImg = data.bannerImg
        this.gallaryImgs = data.gallaryImgs
        this.list = data.categoryList
      }
    }
  },
  mounted () {
    this.getDetailInfo()
  },
  components: {
    DetailHeader,
    detailTop,
    List
  }
}
</script>

<style lang="stylus" scoped>
.write
  height 10rem
</style>
